﻿using CMS.BaseEntity;
using ElectronicSelling.DataAccess;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace CMS.DataAccess
{
    public class SectionAccess
    {
        public bool IsInsertSection(Section section)
        {
            return DataAccess.ExeStoredWithParamToBool("cusp_SectionInsert",
                "@SectionName", section.SectionName,
                "@AuthorId", section.AuthorId,
                "@Description", section.Description,
                "@CreateDate", section.CreateDate,
                "@Enable", section.Enable);
        }

        public DataTable GetSectionById(Section section)
        {
            return DataAccess.ExeStoredWithParamToDataTable("cusp_SectionSelectByID",
                "@SectionId", section.SectionId);
        }

        public bool IsUpdateSection(Section section)
        {
            return DataAccess.ExeStoredWithParamToBool(
                "cusp_SectionUpDate",
                "@SectionId", section.SectionId,
                "@SectionName", section.SectionName,
                "@AuthorId", section.AuthorId,
                "@Description", section.Description,
                "@LastModify", section.LastModify,
                "@Enable", section.Enable);
        }

        public bool IsDeleteSection(Section section)
        {
            return DataAccess.ExeStoredWithParamToBool(
                "cusp_SectionDelete",
                "@SectionId", section.SectionId);
        }

        public DataTable GetListSection()
        {
            return DataAccess.ExeStoredNonToDataTable("cusp_SectionSelectAll");
        }
    }
}